home *** CD-ROM | disk | FTP | other *** search
- /***************************************
- "CColorBitMap.h"
-
- by John A. Love, III [Ph.D. student]
-
- using Symantec's "THINK C / C++", v 6/7
- based on Symantec's "TinyEdit"
- ***************************************/
-
-
-
-
- #pragma once /* Include this file only once */
-
-
- #include <CBitMap.h> /* Include superclass */
-
-
- #define kMaxRowBytes 0x3FFE /* Max # of bytes in a row of pixels. */
- #define kDefaultRes 0x00480000 /* Default resolution is 72 DPI; */
- /* Fixed type. */
- #define kITabRes 4 /* Inverse-table resolution. */
-
-
- /* ... for Error handling in my off-screen map routine(s): */
- enum
- {
- NewPortError = -10000,
- DepthError = -12000,
- MaxRowBytesError = -14000,
- NewBaseAddrPtrError = -16000,
- ColorTableError = -18000,
- CreateGDeviceError = -20000,
- NilGDeviceError = -22000,
- ZoomWindowError = -24000
- };
-
-
- class CColorBitMap : public CBitMap
- {
- public:
-
- /** Additional Instance Variables: **/
-
- /* GrafPtr savePort; -- in superclass */
- GDHandle saveDevice;
-
- /* BitMap saveBitMap; -- in superclass */
- PixMapHandle savePixMap;
-
- /* GrafPtr macPort; -- in superclass */
- PixMapHandle itsPixMap;
- Handle macBits;
- CTabHandle itsColors;
- GDHandle itsMaxDevice;
-
-
- /**
- Additional or Overridden Instance Methods.
- There are two major reasons. The first
- is to accomodate PixMaps in Color QuickDraw.
- The other is to NOT have to HLock the
- CColorBitMap's "itsPixMap" which necessitates
- avoiding all references to "macBitMap"
- **/
-
-
- /* Contruction/Destruction */
- /* */
- /* Note that this method is NOT called "IBitMap" */
- /* because that name is taken by CBitMap's */
- /* constructor method and constructors canNOT be */
- /* virtual or overidden. */
- void IColorBitMap (short width, short height,
- Boolean makePort);
- virtual void Dispose (void);
-
- /* good ole "Switch-A-Roo" */
- void Update (void);
-
- virtual Boolean PixelIsBlack (LongPt *pixelPos);
-
- /* Preparing */
- virtual void BeginDrawing (void);
- virtual void EndDrawing (void);
-
- /* Drawing */
- virtual void CopyFrom (LongRect *fromRect, LongRect *toRect,
- RgnHandle maskRgn);
- virtual void CopyTo (LongRect *fromRect, LongRect *toRect,
- RgnHandle maskRgn);
-
- /* Offseting */
- virtual void GetBounds (LongRect *theBounds);
- virtual void SetBoundsOrigin (short hOrigin, short vOrigin);
-
- /** end of public methods **/
-
- private:
-
- /* Miscellaneous */
- CTabHandle SetupPixMap (PixMapHandle aPixMap, Handle imageBits,
- short bytesPerRow, Rect *theBounds);
- GDHandle CreateGDevice (PixMapHandle basePixMap);
-
- /** end of private methods **/
-
- }; /* CColorBitMap */
-
-
-
-
- /* end: "CColorBitMap.h" */
-